feat: add sbom Makefile target#805
Open
MarkAtwood wants to merge 3 commits into
Open
Conversation
Adds sbom target that produces CycloneDX and SPDX SBOM files for a specific TARGET+SIGN combination. Sources extracted from OBJS variable via wildcard. wolfcrypt sources compiled into wolfBoot are listed as wolfBoot's own sources (not a separate component). Requires GEN_SBOM or WOLFBOOT_LIB_WOLFSSL set.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a make sbom target to generate CycloneDX and SPDX SBOMs for wolfBoot based on the selected build configuration.
Changes:
- Introduces Makefile variables and an
sbomtarget to derive sources from$(OBJS)and runscripts/gen-sbom - Extracts version from
include/wolfboot/version.hto name output artifacts - Adds a host-side preprocessor pass (
cc -dM -E) to provide configuration defines to the SBOM generator
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The sbom target fed `cc -dM -E` an empty /dev/null with only WOLFSSL_USER_SETTINGS, so gen-sbom's build properties collapsed to host compiler builtins (all filtered out as noise) and the SBOM did not reflect the selected configuration. Harvest the actual -D config macros from CFLAGS (filtered in the shell so defines whose values contain spaces, e.g. BOOTLOADER_PARTITION_SIZE=$((...)), survive intact) so the SBOM captures the real TARGET/SIGN/HASH/feature set. Also: - add preflight checks for empty WOLFBOOT_VERSION and missing GEN_SBOM - pass sources via --srcs-file to avoid ARG_MAX on large configs - include .S sources in the source set, not just .c - make HOSTCC and GEN_SBOM overridable - README: soften "CRA Compliance" wording, use wolfboot-<version>.* names, fix dangling wolfssl/doc/CRA.md link to point at the wolfSSL CRA Kit Signed-off-by: Sameeh Jubran <sameeh.j@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
make sbomtarget that produces CycloneDX and SPDX SBOM files for wolfBoot.wolfBoot is unique in that its SBOM must be TARGET- and SIGN-specific: different build configurations compile different sets of wolfcrypt source files directly into the bootloader image.
$(OBJS)via$(wildcard $(patsubst %.o,%.c,...))— no build requiredinclude/wolfboot/version.hTARGETandSIGNmust be set (same as for a normal build)Usage
```sh
make sbom TARGET=stm32h7 SIGN=ECC256 GEN_SBOM=/path/to/gen-sbom
```
Or if wolfssl is present as the
lib/wolfsslsubmodule:```sh
make sbom TARGET=stm32h7 SIGN=ECC256
```
Outputs:
wolfboot-<version>.cdx.json,wolfboot-<version>.spdx.jsonRequirements
GEN_SBOMmust point toscripts/gen-sbomfrom a wolfssl tree with thefeat/sbom-embeddedbranch, ORlib/wolfsslsubmodule must be checked outpython3on the build hostTARGETandSIGNmust match a real build configurationTest plan
make sbom TARGET=stm32h7 SIGN=ECC256 GEN_SBOM=...